package com.molyfun.parents.activity.course.view.courseitem;

import android.content.Context;
import android.view.View;

import com.molyfun.parents.activity.course.bean.CourseMediaBean;

/**
 * Created by william(liuchao.hit@gmail.com).
 * Date:11/4/16.
 */
public class CourseCellFactory {

    public static interface CourseType{
        //1 图片 2视频 3音频 4游戏  5文件
        public static final int COURSE_IMAGE = 1;
        public static final int COURSE_MUSIC = 3;
        public static final int COURSE_GAME = 4;
        public static final int COURSE_VIDEO = 2;
        public static final int COURSE_FILE = 5;
    }

    public static View getFactory(Context context, CourseMediaBean courseMediaBean){
        BaseCourseView baseCourseView = null;
        switch (courseMediaBean.getType()){
            case CourseType.COURSE_VIDEO:
                baseCourseView = new CourseVideoView(context);
                break;
            case CourseType.COURSE_MUSIC:
                baseCourseView = new CourseMusicView(context);
                break;
            case CourseType.COURSE_GAME:
                baseCourseView = new CourseGameView(context);
                break;
            case CourseType.COURSE_FILE:
                baseCourseView = new CourseFileView(context);
                break;
            case CourseType.COURSE_IMAGE:
            default:
                baseCourseView = new CourseImageView(context);
                break;
        }
        baseCourseView.initData(courseMediaBean);
        return baseCourseView;
    }

}
